package models;

import play.*;
import play.db.jpa.*;

import javax.persistence.*;
import java.util.*;

@Entity
public class Condition extends Model {
	
	@ManyToOne
	public Developer applicationId;
	
	@ManyToOne
	public Point point;
	
	@ManyToOne
	public Badge badge;
	
	public long threshold;
	
	public boolean execute(){

			if(point.defaultValue >= threshold && badge.recived == false){
				badge.recived = true;
				badge.save();
				return true;
			}		 	
		  	
			return false;

	  }
}

